package dq.study.concurrent.thread;

/**
 * @author dongqun
 * @version 1.0.0
 * @since 2022/11/19 15:12:00
 */
public class Test {
    public static void main(String [] args){

        ThreadMark_to_win tm = new ThreadMark_to_win();

        tm.setDaemon(true);

        tm.start();

        System.out.println("子线程是精灵线程吗？" +tm.isDaemon());

        try{

            Thread.sleep(1000);

        } catch (InterruptedException ex){

            ex.printStackTrace();

        }

        System.out.println(Thread.currentThread().getName()+"已经结束");

    }



    static class ThreadMark_to_win extends Thread {

        @Override
        public void run(){

            for(int i = 1; i <= 15;i++){

                try{

                    Thread.sleep(100);

                } catch (InterruptedException ex){

                    ex.printStackTrace();

                }

                System.out.println("子线程 "+i);

            }

        }

    }
}
